package com.example.models;

import io.ebean.ExpressionList;
import io.ebean.Finder;
import io.ebean.Model;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "delivery_info")
@Data
public class DeliveryInfo extends Model {
    @Id
    public Integer id;
    public String province;
    public String city;
    public String area;
    public String town;
    public String detailAddress;
    public String name;
    public String mobile;
    public Date createTime;
    public String postalcode;
    public Boolean deleted = false;

    @ManyToOne
    @JoinColumn(name = "user_id")
    public User user;

    public static Finder<Integer, DeliveryInfo> find = new Finder<>(DeliveryInfo.class);

    public static ExpressionList<DeliveryInfo> search() {
        return DeliveryInfo.find.query().where();
    }
}
